<template>
  <el-dialog
    v-el-drag-dialog
    :title="title"
    :visible.sync="visible"
    append-to-body
    width="750px"
  >
    <lb-table
      ref="lbTable"
      border
      highlight-current-row
      element-loading-text="加载中"
      :column="tableData.column"
      :data="tableData.data"
      pagination
      :total="tableData.total"
      custom-column
    />
    <div slot="footer" class="dialog-footer">
      <el-button @click="visible = false">
        关闭
      </el-button>
      <!-- <el-button :loading="$loadingPlugin.add || $loadingPlugin.edit" type="primary" @click="success">
        保存
      </el-button> -->
    </div>
  </el-dialog>
</template>

<script>
  export default {
    name: 'peisongDetail',
    data() {
      return {
        title: null,
        visible: false,
        tableData: {
          total: 0,
          column: [
            { label: '客户编号', prop: 'csmCode', width: 100, align: 'center' },
            { label: '客户名称', prop: 'csmName', width: 150, align: 'center' },
            { label: '客户电话', prop: 'csmPhone', width: 120, align: 'center' },
            { label: '地址', prop: 'csmAddress', width: 200, align: 'left' },
            { label: '配送机构', prop: 'orgName', width: 150, align: 'center' },
            { label: '计划执行状态', prop: 'status', width: 100, align: 'center', formatter: this.statusFormat },
            { label: '未执行原因', prop: 'remark', width: 150, align: 'center' }
            // {
            //   label: '操作',
            //   align: 'center',
            //   fixed: 'right',
            //   width: 210,
            //   render: (h, { row, $index }) => {
            //     return (
            //       <div>
            //         <el-link size='mini' onClick={() => this.planDetail(row, $index)}>
            //           计划详情
            //         </el-link>
            //         <el-link size='mini' type='danger' onClick={() => this.edit(row, $index)}>
            //           编辑
            //         </el-link>
            //         <el-link size='mini' type='danger' onClick={() => this.changeStatus(row, $index)}>
            //           启/禁用
            //         </el-link>
            //       </div>
            //     )
            //   }
            // }
          ],
          data: [
            {
              'corpSN': 8,
              'createTime': '2021-10-20T20:02:03.000+0800',
              'createUserId': 0,
              'csmAddress': '1111',
              'csmAddressId': 3637902,
              'csmCode': '052809',
              'csmId': 3361451,
              'csmName': '培训测试',
              'csmPhone': '135849633333',
              'happendTime': '2021-10-20T20:02:00.000+0800',
              'modifyUserId': 0,
              'orgId': 236,
              'orgName': '农大服务部',
              'orgSNNo': '001002000000000000000',
              'planCode': 'PSJH00050',
              'remark': '地址不存在',
              'status': 1
            },
            {
              'corpSN': 8,
              'createTime': '2021-10-20T20:02:03.000+0800',
              'createUserId': 0,
              'csmAddress': '1',
              'csmAddressId': 3644984,
              'csmCode': '052837',
              'csmId': 3367067,
              'csmName': '皇子',
              'csmPhone': '159599459',
              'happendTime': '2021-10-20T20:02:00.000+0800',
              'modifyUserId': 0,
              'orgId': 237,
              'orgName': '清华服务部',
              'orgSNNo': '001003000000000000000',
              'planCode': 'PSJH00050',
              'remark': '地址不存在',
              'status': 1
            },
            {
              'corpSN': 8,
              'createTime': '2021-10-20T20:02:03.000+0800',
              'createUserId': 0,
              'csmAddress': '民族大道33号',
              'csmAddressId': 3647540,
              'csmCode': '052841',
              'csmId': 3368844,
              'csmName': '张展',
              'csmPhone': '13584963749',
              'happendTime': '2021-10-20T20:02:00.000+0800',
              'modifyUserId': 0,
              'orgId': 20641,
              'orgName': '测试门市',
              'orgSNNo': '001096000000000000000',
              'planCode': 'PSJH00050',
              'remark': '地址不存在',
              'status': 1
            }
          ]
        }
      }
    },
    methods: {
      open(row) {
        this.visible = true
        this.title = `配送详情--${row.planCode}`
        console.log(row)
      },
      success() {
        this.visible = false
      },
      statusFormat: function(row, cloumn) {
        // console.log(cloumn)
        const val = row[cloumn.property]
        var map = ['', '未执行', '已执行']
        return map[val] || ''
      }

    }
  }
</script>
